// TOWN SCRIPT
//    Town 19: Outpost

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

short i,j,k,r1,choice;

body;

beginstate INIT_STATE;
// This state called whenever this town is entered.
		set_state_continue(14);
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// This state is called every turn the party is in this town.
break;

beginstate 11;
	block_entry(1);
	if (get_flag(22,0) == 0){
	reset_dialog_preset_options(5);
	add_dialog_str(0,"A series of ladders leads up to the deck of a small ship.",0);
	choice = run_dialog(0);
	if (choice == 2) {
		move_to_new_town(20,6,24);
		end();
		}
		}
break;

beginstate 14;
	if (get_flag(195,9) == 250)
		end();
	reset_dialog();
	add_dialog_str(0,"A walled enclosure surrounds a small port. Over the walls, you can see the mast of a tall ship. Adobe buildings are linked with a long wooden fence, barring entry.",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);
	set_flag(195,9,250);
break;

beginstate 15;
	reset_dialog_preset_options(2);
	choice = run_dialog(0);
	if (choice == 2) {
	flip_terrain(7,20);
		}
break;
